class JoshphingRing():
    def __init__(self, people_num, step, death_num,start): 
        self.people_num = people_num
        self.step = step
        self.death_num = death_num
        self.start = start
        self.index = self.start - 1 
        self.death_count = 0
        self.order = [x for x in range(1, self.people_num+1)]
    def __next__(self):
        if self.death_count < self.death_num:
            self.index = (self.step + self.index-1)% len(self.order)
            self.order[self.index]
            self.death_count += 1
            death_serial_number = self.order[self.index]
            del self.order[self.index]  
            return death_serial_number
        
    def __iter__(self):
        return self

def main():
    jr = JoshphingRing(15,2,7,1)
    for i in jr:
        if i:
            print(i)
        else:
            break

if __name__ == '__main__':
    main()
